package 美团;

import java.util.Arrays;

public class _645_错误的集合 {
    public int[] findErrorNums(int[] nums) {
        Arrays.sort(nums);
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != i + 1) {
                return new int[]{nums[i], i + 1};
            }
        }
        throw new IllegalArgumentException();
    }
}
